<!DOCTYPE html>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/assets/img/favicon.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicon.ico">
  <link rel="mask-icon" href="/assets/img/favicon.ico" color="#222">
  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-bounce.min.css">
  <script src="/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"lzqblog.top","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"always","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"default"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="写篇post总结一下当年做平衡车的一些经验。这篇post是概述性质的，详细的软硬件设计以后有时间再写吧。">
<meta property="og:type" content="article">
<meta property="og:title" content="项目总结（一）：平衡车的设计概述">
<meta property="og:url" content="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/index.html">
<meta property="og:site_name" content="Coding Spirit">
<meta property="og:description" content="写篇post总结一下当年做平衡车的一些经验。这篇post是概述性质的，详细的软硬件设计以后有时间再写吧。">
<meta property="og:image" content="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/MOSH1.png">
<meta property="og:image" content="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/MOSH2.png">
<meta property="article:published_time" content="2017-11-05T00:43:47.000Z">
<meta property="article:modified_time" content="2018-11-29T02:18:03.000Z">
<meta property="article:author" content="Coding Spirit">
<meta property="article:tag" content="智能车">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/MOSH1.png">

<link rel="canonical" href="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-Hans'
  };
</script>

  <title>项目总结（一）：平衡车的设计概述 | Coding Spirit</title>
  
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-154617667-1"></script>
    <script>
      if (CONFIG.hostname === location.hostname) {
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
        gtag('config', 'UA-154617667-1');
      }
    </script>






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Coding Spirit</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">一位程序员，比较帅的那种</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>Home</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>Tags</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>Categories</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>Archives</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>Search
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="Searching..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

  <a href="https://github.com/codingspirit" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/assets/img/coding_spirit.jpg">
      <meta itemprop="name" content="Coding Spirit">
      <meta itemprop="description" content="毕业于OUC，现就职于Amazon">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Coding Spirit">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          项目总结（一）：平衡车的设计概述
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2017-11-05 08:43:47" itemprop="dateCreated datePublished" datetime="2017-11-05T08:43:47+08:00">2017-11-05</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2018-11-29 10:18:03" itemprop="dateModified" datetime="2018-11-29T10:18:03+08:00">2018-11-29</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93/" itemprop="url" rel="index"><span itemprop="name">项目总结</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="Views" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">Views: </span>
              <span id="busuanzi_value_page_pv"></span>
            </span><br>
            <span class="post-meta-item" title="Symbols count in article">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">Symbols count in article: </span>
              <span>1.7k</span>
            </span>
            <span class="post-meta-item" title="Reading time">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">Reading time &asymp;</span>
              <span>2 mins.</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>写篇post总结一下当年做平衡车的一些经验。这篇post是概述性质的，详细的软硬件设计以后有时间再写吧。</p>
<a id="more"></a>

<h2 id="写在前面"><a href="#写在前面" class="headerlink" title="写在前面"></a>写在前面</h2><p>其实大二大三的时候都有参加智能车竞赛(原来叫飞思卡尔智能车竞赛，简称飞赛，后来飞思卡尔被nxp收购，改名恩智浦智能车竞赛..)，但是学院有个政策，不允许同一年既参加电子设计竞赛（简称电赛）又参加飞赛，理由是要让更多的同学有机会参加到比赛中（至少老师是这么告诉我们的），于是大二那一年做智能车做到一半就弃权参加电赛去了。不过后来我和我的小伙伴们发现，居然有些同学两个比赛都参加了，这TM就很尴尬了。。</p>
<h2 id="硬件基本架构"><a href="#硬件基本架构" class="headerlink" title="硬件基本架构"></a>硬件基本架构</h2><p>概括来讲，需要关心的是三个部份:</p>
<h3 id="1-电源"><a href="#1-电源" class="headerlink" title="1.电源"></a>1.电源</h3><p>首先稳压电路是一定会有的，我们选用了LM1117，外围电路简单，使用十分方便，可替代的LDO也不少。另外如果使用MOS管自己搭H桥，就需要boost电路了。</p>
<h3 id="2-主控部分"><a href="#2-主控部分" class="headerlink" title="2.主控部分"></a>2.主控部分</h3><p>这个部分包括MCU最小系统以及各种传感器。对于平衡车而言，陀螺仪、角度传感器和编码器、图像传感器都算是核心传感器，一个用于获取角加速度，一个获取当前角度，一个获取电机转速，最后一个当然是识别赛道啦。除此之外，我们还使用了蓝牙模块，自己写了个上位机，无线调车、实时图传简直不能再爽。</p>
<h3 id="3-驱动桥（H桥）"><a href="#3-驱动桥（H桥）" class="headerlink" title="3.驱动桥（H桥）"></a>3.驱动桥（H桥）</h3><p>平衡车是有两个电机的，而且两个电机都要求能够正反转，因此需要两个全桥，需要4片BTS7970或者8片mos。大二图方便，使用的是BTS7970，淘宝上一片二三十。。。<br>大三总裁用mos管搭了一个，效果差不多，成本却低了不少。后来我毕设要用到电机控制又自己画了一块，虽然只是双面板并且为了过大电流大面积开窗，但是花点时间优化layout还是可以把板子做得很小。大三的电路图由于硬盘挂了找不到了:( 贴个毕设搭的MOSH Layout图：</p>
<p><img src="/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/MOSH1.png" alt="Top" title="Top"><br><img src="/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/MOSH2.png" alt="Bottom" title="Bottom"></p>
<p>设计文件挺早的时候就上传了：<br><a href="https://github.com/codingspirit/MOS_H" target="_blank" rel="noopener">Coding Spirit:MOS_H</a></p>
<h2 id="MCU选型"><a href="#MCU选型" class="headerlink" title="MCU选型"></a>MCU选型</h2><p>大二用的是coldfire，大三用的是K60。Coldfire是freescale自己的架构，当时我们用的mcf52255, 最高80MHz，K60是Cortex-M4，最高100MHz，另外带FPU。<br>就我的个人感觉来说，K60的综合性能是要好于mcf52255的。另外coldfire资料不如k60多，这点对于初学者来说比较关键，因为从准备到参赛只有几个月的时间，从头开始学一款没接触过的架构的MCU会花掉大量时间。但是Coldfire配合Codewarrior有种STM32CUBEMX的感觉，代码生成感觉还不错。</p>
<h2 id="软件基本架构"><a href="#软件基本架构" class="headerlink" title="软件基本架构"></a>软件基本架构</h2><p>首先贴个代码：<a href="https://github.com/codingspirit/Balance_Car" target="_blank" rel="noopener">Coding Spirit:Balance_Car</a></p>
<h3 id="是否跑RTOS"><a href="#是否跑RTOS" class="headerlink" title="是否跑RTOS"></a>是否跑RTOS</h3><p>裸奔和RTOS其实都能做，但由于PID控制的周期性，使用定时器中断控制周期，进行采样、计算、输出显得非常和谐，任务不多的情况下裸奔其实更合理一点。我们也使用了这种方式，通过1ms的定时器中断进行状态机的切换。</p>
<h3 id="PID控制"><a href="#PID控制" class="headerlink" title="PID控制"></a>PID控制</h3><p>对于自动化专业的学生来说，这种控制还是蛮简单的。首先平衡车需要实现三个闭环：<br>1.角度闭环：建议使用PD控制。如果有陀螺仪的话不用计算差分，直接把Kd*陀螺仪测量值作为D项就可以了。我尝试过加入I项，要么系统滞后非常严重，要么没什么用。。。<br>2.速度闭环：建议使用PI控制。建议不加入D项的原因是系统不需要预测速度，速度是我们直接给定的，比较稳定。<br>3.转向闭环: 当时使用的是PD控制。D项来源于纵向的陀螺仪测量值，我们担心会出现转向过猛的情况，加入D负反馈限制了转向加速度，不然容易出现P参数过大时车体原地打转的<br>情况。<br>另外增量式和位置式PID的选择不用过多纠结，只有速度环有I项，积分饱和的情况很少见。不过积分限幅和输出限幅很有必要，不然车很容易撞坏。。</p>
<h3 id="上位机"><a href="#上位机" class="headerlink" title="上位机"></a>上位机</h3><p>我设计了个简陋的通信协议，并且写了两个配套的上位机，一个是初代没有图传功能，用VC++写的，V2.0就用C#写了一个可以实时传输图像的上位机，另外使用了自创的蜜汁压缩，稳定30fps哦！这里吹一波，比那些每4秒1帧的好到不知道哪里去了。但是当时着急用，代码写得很乱。。。<br>V2.0源代码在此：<a href="https://github.com/codingspirit/CarDebugger_V2.0" target="_blank" rel="noopener">Coding Spirit:Car_Debugger_V2.0</a></p>

    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>Post author:  </strong>Coding Spirit
  </li>
  <li class="post-copyright-link">
    <strong>Post link: </strong>
    <a href="https://lzqblog.top/2017-11-05/%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93%EF%BC%88%E4%B8%80%EF%BC%89%EF%BC%9A%E5%B9%B3%E8%A1%A1%E8%BD%A6%E7%9A%84%E8%AE%BE%E8%AE%A1%E6%A6%82%E8%BF%B0/" title="项目总结（一）：平衡车的设计概述">https://lzqblog.top/2017-11-05/项目总结（一）：平衡车的设计概述/</a>
  </li>
  <li class="post-copyright-license">
    <strong>Copyright Notice:  </strong>All articles in this blog are licensed under <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> unless stating additionally.
  </li>
</ul>
</div>


      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/%E6%99%BA%E8%83%BD%E8%BD%A6/" rel="tag"><i class="fa fa-tag"></i> 智能车</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2017-11-01/%E5%B8%B8%E7%94%A8%E7%9A%84Regex/" rel="prev" title="常用的Regex">
      <i class="fa fa-chevron-left"></i> 常用的Regex
    </a></div>
      <div class="post-nav-item">
    <a href="/2017-11-07/%E5%85%B3%E9%97%AD%E7%A8%8B%E5%BA%8F%E7%AA%97%E5%8F%A3%E5%90%8E%E4%BB%8D%E6%9C%89%E7%BA%BF%E7%A8%8B%E6%AE%8B%E7%95%99%E7%9A%84%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95/" rel="next" title="关闭程序窗口后仍有线程残留的解决办法">
      关闭程序窗口后仍有线程残留的解决办法 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="gitalk-container"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#写在前面"><span class="nav-number">1.</span> <span class="nav-text">写在前面</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#硬件基本架构"><span class="nav-number">2.</span> <span class="nav-text">硬件基本架构</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-电源"><span class="nav-number">2.1.</span> <span class="nav-text">1.电源</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-主控部分"><span class="nav-number">2.2.</span> <span class="nav-text">2.主控部分</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-驱动桥（H桥）"><span class="nav-number">2.3.</span> <span class="nav-text">3.驱动桥（H桥）</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#MCU选型"><span class="nav-number">3.</span> <span class="nav-text">MCU选型</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#软件基本架构"><span class="nav-number">4.</span> <span class="nav-text">软件基本架构</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#是否跑RTOS"><span class="nav-number">4.1.</span> <span class="nav-text">是否跑RTOS</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#PID控制"><span class="nav-number">4.2.</span> <span class="nav-text">PID控制</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#上位机"><span class="nav-number">4.3.</span> <span class="nav-text">上位机</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Coding Spirit"
      src="/assets/img/coding_spirit.jpg">
  <p class="site-author-name" itemprop="name">Coding Spirit</p>
  <div class="site-description" itemprop="description">毕业于OUC，现就职于Amazon</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">113</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">10</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">39</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/codingspirit" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;codingspirit" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:596544399@qq.com" title="E-Mail → mailto:596544399@qq.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

      
        
          <div id="musicPlayerPost">
            <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=400876433&auto=0&height=66"></iframe>
          </div>
        
      
      

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Powered by Coding Spirit. All rights reserved.</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="Symbols count total">220k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="Reading time total">3:20</span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="Total Visitors">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="Total Views">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  
  <script>
    (function(){
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x=document.getElementsByTagName("link");
		//Find the last canonical URL
		if(x.length > 0){
			for (i=0;i<x.length;i++){
				if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
					canonicalURL=x[i].href;
				}
			}
		}
    //Get protocol
	    if (!canonicalURL){
	    	curProtocol = window.location.protocol.split(':')[0];
	    }
	    else{
	    	curProtocol = canonicalURL.split(':')[0];
	    }
      //Get current URL if the canonical URL does not exist
	    if (!canonicalURL) canonicalURL = window.location.href;
	    //Assign script content. Replace current URL with the canonical URL
      !function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
  </script>




  
<script src="/js/local-search.js"></script>













  

  

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css">

<script>
NexT.utils.loadComments(document.querySelector('#gitalk-container'), () => {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js', () => {
    var gitalk = new Gitalk({
      clientID    : '965ca656ae3d59a50b73',
      clientSecret: '94dbe9c760ce8b778c84481a7fe2f37f548d7375',
      repo        : 'blog-gitalk',
      owner       : 'codingspirit',
      admin       : ['codingspirit'],
      id          : 'ccc83f70583f733605144da532c08486',
        language: '',
      distractionFreeMode: true
    });
    gitalk.render('gitalk-container');
  }, window.Gitalk);
});
</script>

</body>
  
    <canvas class="fireworks" style="position: fixed;left: 0;top: 0;z-index: 1; pointer-events: none;" ></canvas>
    <script type="text/javascript" src="//cdn.bootcss.com/animejs/2.2.0/anime.min.js"></script>
    <script type="text/javascript" src="/js/src/fireworks.js"></script>
  
</html>
